//
//  SISSUploadImageRemarkShowViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2019/7/5.
//  Copyright © 2019 优房网. All rights reserved.
//

#import "SISSUploadImageRemarkShowViewController.h"
#import "SISSUploadImageRemarkViewController.h"

@interface SISSUploadImageRemarkShowViewController ()

@property (weak, nonatomic) UIButton *modifyButton;

@end

@implementation SISSUploadImageRemarkShowViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}


#pragma mark - 按钮点击事件
- (void)modifyButtonClickAction {
    SISSUploadImageRemarkViewController *vc = [[SISSUploadImageRemarkViewController alloc] init];
    
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - UI
- (void)setupSubviews {
    [super setupSubviews];
    
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.scrollView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    self.containerView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    SISSUploadImageShowView *uploadImageShowView = [[SISSUploadImageShowView alloc] init];
    [self.containerView addSubview:uploadImageShowView];
    self.uploadImageShowView = uploadImageShowView;
    
    SISSShowView *remarkView = [[SISSShowView alloc] init];
    remarkView.isShowBottomLine = YES;
    remarkView.leftStr = @"备注";
    [self.containerView addSubview:remarkView];
    self.remarkView = remarkView;
    
    SISSShowView *createDateView = [[SISSShowView alloc] init];
    createDateView.isShowBottomLine = YES;
    createDateView.leftStr = @"创建时间";
    createDateView.rightStr = @"";
    [self.containerView addSubview:createDateView];
    self.createDateView = createDateView;
    
    UIButton *modifyButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [modifyButton setTitle:@"变更" forState:UIControlStateNormal];
    [modifyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [modifyButton setBackgroundColor:MAIN_COLOR];
    [modifyButton addTarget:self action:@selector(modifyButtonClickAction) forControlEvents:UIControlEventTouchUpInside];
    modifyButton.layer.cornerRadius = 4;
    modifyButton.layer.masksToBounds = YES;
    modifyButton.hidden = self.isHistory;
    [self.containerView addSubview:modifyButton];
    self.modifyButton = modifyButton;
    
}

#pragma mark - 约束
- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGSize buttonSize = CGSizeMake(SCREEN_WIDTH * 0.8, 54);
    [self.uploadImageShowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.containerView).offset(globelMargin);
        make.left.right.equalTo(weakSelf.containerView);
    }];
    
    [self.remarkView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.uploadImageShowView.mas_bottom).offset(2 * globelMargin);
        make.left.right.equalTo(weakSelf.containerView);
    }];
    
    
    [self.createDateView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.remarkView.mas_bottom);
        make.left.right.equalTo(weakSelf.containerView);
        make.height.mas_equalTo(5.5 * globelMargin);
        
//        make.bottom.equalTo(weakSelf.containerView).offset(-2 * globelMargin);
    }];
    
    [self.modifyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.createDateView.mas_bottom).offset(3 * globelMargin);
        make.centerX.equalTo(weakSelf.containerView.mas_centerX);
        make.size.mas_equalTo(buttonSize);
        make.bottom.equalTo(weakSelf.containerView).offset(-2 * globelMargin);
    }];
    
}


@end
